package com.cskaoyan.controller;

import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.StatGoodsVO;
import com.cskaoyan.bean.vo.StatOrderVO;
import com.cskaoyan.bean.vo.StatUserVO;
import com.cskaoyan.service.StatService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author catsanea
 */
@RestController
public class StatController {

    @Autowired
    StatService statService;


    //用户
    @RequiresPermissions("admin:stat:user")
    @RequestMapping("/admin/stat/user")
    public BaseRespVo user() {
        StatUserVO statUserVO = statService.statUser( );
        return BaseRespVo.success(statUserVO );
    }

    //订单
    @RequiresPermissions("admin:stat:order")
    @RequestMapping("/admin/stat/order")
    public BaseRespVo order() {
        StatOrderVO statOrderVO = statService.statOrder( );
        return BaseRespVo.success(statOrderVO);
    }

    //商品
    @RequiresPermissions("admin:stat:goods")
    @RequestMapping("/admin/stat/goods")
    public BaseRespVo goods() {
        StatGoodsVO statGoodsVO = statService.statGoods( );
        return BaseRespVo.success(statGoodsVO);
    }

}
